package com.lifetime.controller;

import com.lifetime.service.RecoveryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@Controller
public class RecoveryController {
    @Autowired
    RecoveryService recoveryService;

    @GetMapping("recoveryPic")
    public Object RecoveryPic(HttpServletRequest request) {
        int userId = Integer.parseInt(request.getSession().getAttribute("userId").toString());
        //   int userId=1;
        if (userId == 0) {
            return null;
        }
        return recoveryService.getRecoveryPic(userId);
    }

}
